fix: harden lifecycle cleanup and process smoke#142
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR strengthens lifecycle reliability across provider cleanup, provider-operation shutdown behavior, and ACP client cancellation/process smoke. It also wires CI and releaseguard checks so real-process lifecycle smokes run in dedicated Linux + native Windows steps and are excluded from race/coverage.
Changes:
- Provider cleanup dispatch now returns classified errors (query/scan/iterate/close) with rate-limited logging, and tests assert durable-row completion and diagnostic behavior.
- Provider-operation tests now cover service-boundary post-stop behavior and cancellation during startup reconciliation with redaction guarantees.
- ACP client cancellation removes the post-send grace; real-process smokes are time-bounded, reliably kill/reap on timeout, and are isolated into dedicated CI steps guarded by releaseguard.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/releaseguard/workflow_test.go | Adds workflow contract assertions for dedicated lifecycle smoke steps and paired race-skip selector. |
| internal/daemon/provider_operations_test.go | Extends shutdown coverage to service boundary and startup reconciliation cancellation/redaction. |
| internal/daemon/provider_cleanup.go | Returns structured dispatch errors, joins row close errors, and rate-limits repeated diagnostics. |
| internal/daemon/provider_cleanup_test.go | Adds regression tests for joined row errors, query failure classification, log suppression, and fairness completion. |
| internal/acpclient/profiles_process_test.go | Updates cross-process profile lock tests to use the shared lifecycle smoke timeout and reap on failure. |
| internal/acpclient/fixture_test.go | Introduces shared 30s process-smoke timeout and a channel wait helper for process lifecycle tests. |
| internal/acpclient/client.go | Removes the fixed post-cancel grace and proceeds directly to bounded teardown/reap. |
| internal/acpclient/client_test.go | Adds a synctest timing regression, preserves exact-once in-process cancellation proof, and retags real-process smokes. |
| internal/acpclient/background_process_lock_test.go | Retags real-process profile lifecycle tests and replaces fixed waits with the shared helper/timeout. |
| .github/workflows/ci.yml | Adds dedicated Linux + native Windows lifecycle smoke steps and updates the race skip to exclude lifecycle smokes. |
| docs/plans/2026-07-16-ratchet-cli-lifecycle-reliability.md.scope-lock | Adds scope-lock hash for the implementation plan. |
| docs/plans/2026-07-16-ratchet-cli-lifecycle-reliability.md | Adds the implementation plan detailing tasks, proofs, and rollback strategy. |
| docs/plans/2026-07-16-ratchet-cli-lifecycle-reliability-plan-review.md | Adds adversarial plan review report and resolutions. |
| docs/plans/2026-07-16-ratchet-cli-lifecycle-reliability-design.md | Adds approved design for cleanup diagnostics, shutdown coverage, cancellation teardown, and CI isolation. |
| docs/plans/2026-07-16-ratchet-cli-lifecycle-reliability-design-review.md | Adds adversarial design review report and resolutions. |
| docs/plans/2026-07-16-ratchet-cli-lifecycle-reliability-alignment.md | Adds alignment report mapping design requirements to plan tasks and scope checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design
See
docs/plans/2026-07-16-ratchet-cli-lifecycle-reliability-design.md.Implementation Plan
See
docs/plans/2026-07-16-ratchet-cli-lifecycle-reliability.md.Scope Manifest
fix/reliability-followupsChanges
Rows.Closefailures; equivalent diagnostics are emitted at most once per minute and reset after recovery.TestACPClientLifecycleBinarySmokeand a 30-second transition bound. Timed-out profile children are killed and reaped before failure.windows-2025CI jobs run the dedicated selector; race coverage skips only command and lifecycle binary smokes.Security Boundary
Regression Proofs
Provider cleanup, fix reverted:
Provider cleanup, fix restored: focused tests, 30 fairness repetitions, and 10 race repetitions pass.
ACP grace restored:
ACP grace removed: timing test passes; cancellation count 10, lifecycle smoke count 20, and race-focused count 5 pass. The SDK scheduling assumption was backported to the design after stress exposed asynchronous peer-handler dispatch.
CI lifecycle step removed:
CI lifecycle step restored: releaseguard, dedicated smoke, and race-with-skip gates pass.
Verification
Runtime Launch Transcript
Native Windows lifecycle execution is required from the existing PR job before merge.
Doc-reconciliation: 1 item fixed - the design now records that ACP notification bytes reach the peer reader before asynchronous handler dispatch.